<template>
  <div id="echarts">
      <div id="main" style="width:600px;height:400px;"></div>
  </div>
</template>

<script>
export default {
    name:'echarts',
    methods:{
        drawChart(){
            let myChart=this.$echarts.init(document.getElementById('main'));
            let option={
                title:{
                    Text:'ECharts入门实例'
                },
                tooltip:{},
                legend:{
                    data:['销量']
                },
                xAxis:{
                    data:["柴","米","油","盐"]
                },
                yAxis:{},
                series:[{
                    name:'销量',
                    type:'bar',
                    data:[20,15,10,5]
                }]
            };
            myChart.setOption(option);
        }
    },
    mounted(){
        this.drawChart();
    }
}
</script>

<style>

</style>